home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-04 | 4.1 KB | 158 lines | [TEXT/NISI] |
- ONLY DEVELOPMENT
- ALSO MAC
- ALSO ASSEMBLER
- ALSO FORTH DEFINITIONS
-
- HEADER new.COLD.start
- CODE new.COLD
- \
- \ first test to see if AppleEvents are available
- \ and we have come through here before
- \
- MOVE.L MACH2.flags,D0
- BTST #1,D0
- BEQ.S @first.part
-
- \ now test to see if the IOTASK has been already set up
- BTST #4,D0
- BEQ.S @first.part
-
- ANDI.L #$FFFFFFEF,MACH2.flags
- BRA.S @second.part
-
- @first.part
- ORI.L #$10,MACH2.flags
- JSR $14A(A5) \ - INIT calls, code4,off32
- JSR $-2BEA(PC) \ $4B4B6E - create SYS_WINDOW
- [ HERE 2- ' new.COLD.start - 12252 + \ offset of this instruction
- $4B4B6E $4B4AA8 - \ offset of routine
- - NEGATE HERE 2- W! ]
-
- JSR $5A2(A5) \ - save var ptr in -55E(A5)
- \ allocate stack space
- \ setup D4 for trap stack
- JSR $47A(A5) \ - set exception vectors
- JSR $-EC(PC) \ $4B7678 - patch trap $A9C9
- [ HERE 2- ' new.COLD.start - 12252 + \ offset of this instruction
- $4B7678 $4B4AA8 - \ offset of routine
- - NEGATE HERE 2- W! ]
-
- JSR $182(A5) \ - init, allocate blocks
- JSR $54A(A5) \ EMPTY-BUFFERS
- JSR $27A(A5) \ clear various Variables
- JSR $1B2(A5) \ initialize ioCompletion procs
- JSR $30A(A5) \ - setup the ioTask
- \ we are now on the ioTask A7
-
- \ now test to see if we should skip back for the AppleEvents
- \
- MOVE.L MACH2.flags,D0
- BTST #1,D0
- BNE.S @thisexit
-
- @second.part
- JSR $-5B4(PC) \ $4B71C8 - install dictionary
- [ HERE 2- ' new.COLD.start - 12252 + \ offset of this instruction
- $4B71C8 $4B4AA8 - \ offset of routine
- - NEGATE HERE 2- W! ]
-
- JSR $-292(PC) \ $4B74EE - setup VP
- [ HERE 2- ' new.COLD.start - 12252 + \ offset of this instruction
- $4B74EE $4B4AA8 - \ offset of routine
- - NEGATE HERE 2- W! ]
-
- JSR $-23E(PC) \ $4B7546 - setup new code segment
- [ HERE 2- ' new.COLD.start - 12252 + \ offset of this instruction
- $4B7546 $4B4AA8 - \ offset of routine
- - NEGATE HERE 2- W! ]
-
- JSR $-2D8(PC) \ $4B74B0 - allocate hash table
- [ HERE 2- ' new.COLD.start - 12252 + \ offset of this instruction
- $4B74B0 $4B4AA8 - \ offset of routine
- - NEGATE HERE 2- W! ]
-
- JSR $1F2(PC) \ $4B797E - create hash table
- [ HERE 2- ' new.COLD.start - 12252 + \ offset of this instruction
- $4B797E $4B4AA8 - \ offset of routine
- - NEGATE HERE 2- W! ]
-
- @thisexit
- RTS
- END-CODE
- HEADER new.COLD.end
-
- : patch.CODE10
- { | resh CODE10.ptr old.COLD.entry res.refnum
- @filename }
- ASCII CODE 10 CALL GetResource -> resh
- resh 0= NOT
- IF
- resh CALL HandToHand 0= NOT
- IF
- CR ." Could not duplicate the CODE 10 handle."
- THEN
- -> resh
- resh CALL GetHandleSize
- ['] new.COLD.end ['] new.COLD.start - +
- resh SWAP CALL SetHandleSize
- 0= NOT
- IF
- CR ." Could not increase CODE 10 to add patch."
- resh CALL DisposHandle DROP
- ABORT
- THEN
- resh CALL HLock DROP
- ( copy the new code into the segment )
- resh @ CALL StripAddress -> CODE10.ptr
- ['] new.COLD.start
- code10.ptr 12256 +
- ['] new.COLD.end ['] new.COLD.start -
- CMOVE
-
- ( now patch the old COLD routine )
- $4B7752 $4B4AA4 - CODE10.ptr + -> old.COLD.entry
- $4EFA old.COLD.entry W! ( JMP d(PC) )
- CODE10.ptr 12256 +
- CODE10.ptr $4B7752 $4B4AA4 - +
- - 2-
- old.COLD.entry 2+ W!
-
- ( the routine is patched, now write it out to a file )
- " New CODE10" -> @filename
- @filename CALL CreateResFile
- @filename CALL OpenResFile -> res.refnum
- res.refnum -1 =
- IF
- CR ." Could not open the output resource file. Use BYE."
- resh CALL HUnlock DROP resh CALL DisposHandle DROP
- ABORT
- THEN
- res.refnum CALL UseResFile
-
- ( delete any old resource )
- ASCII CODE 10 CALL GetResource
- DUP 0<
- IF
- CR ." Resource Error while trying to access CODE10 file."
- resh CALL HUnlock DROP resh CALL DisposHandle DROP
- res.refnum CALL CloseResFile
- ABORT
- THEN
- CALL RmveResource
- res.refnum CALL UpdateResFile
-
- ( add the resource )
- resh ASCII CODE 10 " Compiler" CALL AddResource
- res.refnum CALL UpdateResFile
- res.refnum CALL CloseResFile
-
- resh CALL HUnlock DROP
- resh CALL DisposHandle DROP
- ELSE
- CR ." Could not get the Code 10 resource." ABORT
- THEN
- ;
-
- CR .( Execute the word "patch.CODE10" to write out the new )
- CR .( CODE 10 resource to the file "New CODE10" )
- CR